<template>
  <elm-page-bb>
    <el-form ref="model" :model="model" size="small" label-width="120px">
      <elm-row>
        <el-form-item label="工作名称" prop="name" :rules="[{ required: true, message: '工作名称必须填写'}]">
          {{model.name}}
        </el-form-item>
      </elm-row>
      <elm-row>
        <el-form-item label="实际开始时间" prop="sj_start_time">
          <el-date-picker v-model="model.sj_start_time" type="datetime" value-format="yyyy-MM-ddTHH:mm:ss" style="width: 100%"></el-date-picker>
        </el-form-item>
        <el-form-item label="实际结束时间" prop="sj_end_time">
          <el-date-picker v-model="model.sj_end_time" type="datetime" value-format="yyyy-MM-ddTHH:mm:ss" style="width: 100%"></el-date-picker>
        </el-form-item>
      </elm-row>
      <elm-row>
        <el-form-item label="状态" prop="status">
          <el-select v-model="model.status" style="width: 100%">
            <el-option v-for="item in status_arr" :key="item" :label="item" :value="item"></el-option>
          </el-select>
        </el-form-item>
      </elm-row>
      <el-form-item label="备注">
        <el-input type="textarea" v-model="model.remark" :rows="2"></el-input>
      </el-form-item>
    </el-form>
    <template #bottom>
      <el-button type="success" size="small" @click="submit" model.>立即保存</el-button>
      <el-button size="small" @click="close">取消</el-button>
    </template>
  </elm-page-bb>
</template>

<script>
export default {
  extends: elmVueBase,
  data() {
    return {
      model: {
        id: elm.dialog.request.id,
      },
      status_arr: ['待开始','进行中','已完成','已延期'],
    }
  },
  created() {
  },
  methods: {
    async submit() {
      await this.$refs["model"].validate();
      let res = await elm.post('/business/my/UpsertPjTask', this.model);
      if (res == true) {
        this.request.callVue.tablebinding(elm.dialog.request.table_ref);
        this.close();
        this.v('保存成功。');
      }
      else {
        this.error('保存失败，请稍后尝试。');
      }
    }
  }
}
</script>

<style scoped>
</style>